<template>
  <el-dialog width="70vw" :visible.sync="visible" title="奖惩详情" :close-on-click-modal="false" @open="handleOpen" @closed="handleClosed">
    <QupList v-loading="loading" :column="3" sep="：" default-value="" label-position="right" label-width="130">
      <QupListItem label="奖惩编码" :value="detail.rewardPunishmentCode" />
      <QupListItem label="奖惩名称" :value="detail.rewardPunishmentName" />
      <QupListItem label="业务账号编码" :value="detail.businessAccount" />
      <QupListItem label="业务账号名称" :value="detail.businessAccountName" />
      <QupListItem label="所属办事处" :value="detail.agencyName" />
      <QupListItem label="办事处类型" :value="detail.agencyType" dict-type-code="OFFICE_NATURE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="通报类别" :value="detail.notificationType" dict-type-code="CIRCULATE_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="文件编号" :value="detail.fileNumber" />
      <QupListItem label="文件名称" :value="detail.fileName" />
      <QupListItem label="发文部门" :value="detail.dispatchDepartmentName" />
      <QupListItem label="数据来源" :value="detail.dataSource===1?'手工新增':'BPM'" />
      <QupListItem label="BPM流程号" :value="detail.bpmNumber" />
      <QupListItem label="创建人" :value="detail.applicantName" />
      <QupListItem label="创建时间" :value="detail.applyTime" />
      <QupListItem label="启用状态" :value="detail.enable===1?'启用':'停用'" />
      <QupListItem label="申请人AD账号" :value="detail.applicantCode" />
      <QupListItem label="申请人姓名" :value="detail.applicantName" />
      <QupListItem label="申请时间" :value="detail.applyTime" />
      <QupListItem label="奖惩类别" :value="detail.rewardPunishmentCategory" dict-type-code="SHOP_REWARD_PUNISH_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="处罚金额类型" :value="detail.penaltyType" dict-type-code="FINE_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="奖励金额" :value="detail.rewardAmount" />
      <QupListItem label="计划处罚金额" :value="detail.plannedPenaltyAmount" />
      <QupListItem label="库房占用费" :value="detail.warehouseOccupancyFee" />
      <QupListItem label="账务日期" :value="detail.financeDate" />
      <QupListItem label="奖惩原因" :value="detail.disciplinaryReasons" :span="24" />
      <QupListItem label="是否有减免" :value="detail.isDerate" dict-type-code="BOOLEANS" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="减免金额" :value="detail.derateAmount" />
      <QupListItem label="实际处罚金额" :value="detail.actualPenaltyAmount" />
      <QupListItem label="减免原因" :value="detail.derateReasons" :span="24" />
      <QupListItem label="减免申请人AD账号" :value="detail.derateApplicantCode" />
      <QupListItem label="减免申请时间" :value="detail.derateApplyTime" />
      <QupListItem label="减免流程号" :value="detail.derateNumber" />
      <QupListItem label="减免申请人姓名" :value="detail.derateApplicantName" />
      <QupListItem label="减免文件类型" :value="detail.derateFileType" dict-type-code="DERATE_FILE_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
      <QupListItem label="减免类别" :value="detail.derateType" dict-type-code="DERATE_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
    </QupList>
    <div class="btn-center">
      <c-button type="primary" @click="handleGoBack">返回</c-button>
    </div>
  </el-dialog>
</template>
<script>
import { rewardsAndPunishmentDetail } from '@/api/channelTask2/dealerCustomer'
export default {
  name: 'RewardsAndPunishmentDetail',
  data() {
    return {
      loading: false,
      visible: false,
      detail: {},
      id: ''
    }
  },
  methods: {
    openDialog(id) {
      this.id = id
      this.visible = true
    },
    handleOpen() {
      this.loading = true
      rewardsAndPunishmentDetail(this.id).then(res => {
        this.detail = res.data
      }).finally(() => {
        this.loading = false
      })
    },
    handleClosed() {
      this.detail = {}
      this.id = ''
    },
    handleGoBack() {
      this.visible = false
    }
  }
}
</script>
